package day09API.stream;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * @author DBX
 * @date 2021/8/26 0026 - 16:54
 */
public class BufferedDemo {
    public static void main(String[] args) throws Exception{
        FileInputStream fis = new FileInputStream("./File/TiMo1.jpeg");
        BufferedInputStream bis = new BufferedInputStream(fis);
        FileOutputStream fos = new FileOutputStream("./File/mkdir/TiMo1.jpeg");
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        int b ;
        long time = System.currentTimeMillis();
        while ((b=bis.read())!=-1){
            bos.write(b);
        }
        long time1 = System.currentTimeMillis();
        int a ;
        long time3 = System.currentTimeMillis();
        while ((a = fis.read())!=-1){
            fos.write(a);
        }
        long time4 = System.currentTimeMillis();
        System.out.println(time1-time);
        System.out.println(time4-time3);
        bis.close();
        bos.close();


    }
}
